package com.kymatrix.kycarbon.xsmd.kbpm.server.model.enums;

import cn.hutool.core.convert.Convert;
import com.kymatrix.kycarbon.xsmd.common.business.common.BaseBusinessEnum;
import java.util.Arrays;

/**
* 会签类型
*/
public enum CountersignTypeEnum implements BaseBusinessEnum {
    PARALLEL("0", "并行会签"),
    SEQUENTIAL("1", "串行会签"),
    ;
    private final String code;

    private final String name;
    public static CountersignTypeEnum codeOf(Object code) {
        return Arrays.stream(CountersignTypeEnum.class.getEnumConstants()).filter(e ->
                e.getCode().equals(Convert.toInt(code))
                        || e.name().equalsIgnoreCase(Convert.toStr(code))
                        || e.getName().equalsIgnoreCase(Convert.toStr(code))
        ).findAny().orElse(CountersignTypeEnum.PARALLEL);
    }

    CountersignTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    @Override
    public String getSysConfigGroupName() {
        return SysConfigGroupName.WF_COUNTERSIGN_TYPE;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

}
